%%
%% This is file `scunthesis.cls',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% scunthesis.dtx  (with options: `cls')
%%
%% This is a generated file.
%%
%% Copyright (C) 2016-2016 by Yang Ximin <refmanager@163.com>
%%
%% This file may be distributed and/or modified under the conditions of the LaTeX Project Public License, either version 1.3a
%% of this license or (at your option) any later version.
%% The latest version of this license is in:
%%
%% http://www.latex-project.org/lppl.txt
%%
%% and version 1.3a or later is part of all distributions of LaTeX version 2004/10/01 or later.
%%
%% To produce the documentation run the original source files ending with `.dtx' through LaTeX.
%%
\NeedsTeXFormat{LaTeX2e}[1999/12/01]
\ProvidesClass{scunthesis}[2016/09/11 1.0 South-Central University for Nationalities Thesis Template]

\LoadClass[12pt, a4paper, twoside, openany]{book}% 加载 \pkg{book} 类。

\RequirePackage[utf8]{inputenc}
\RequirePackage{ifxetex}%
\RequirePackage{etoolbox}%TeX扩展工具包
\RequirePackage{kvoptions}%键值对，参数和选项处理
\RequirePackage{xifthen}%条件处理宏包
\RequirePackage{cn-fonts}%自定义的中文字体包
\RequirePackage{geometry}%页面设置宏包
\RequirePackage{fancyhdr}%页眉和页脚设置宏包
\RequirePackage{setspace}%行距设置宏包
\RequirePackage{titletoc}%目录格式设置宏包
\RequirePackage{titlesec}%标题格式设置
\RequirePackage{indentfirst}%段落首行缩进
\RequirePackage[bottom,perpage,hang]{footmisc}%脚注设置宏包
\RequirePackage{pifont}%脚注带圈序号设置
\RequirePackage[hidelinks]{hyperref}%超链接和交叉引用宏包
\RequirePackage{xparse}
\RequirePackage{amsmath}%数学公式
\RequirePackage{amssymb}%符号
\RequirePackage{enumitem}%多级标题支持宏包
\RequirePackage[calc]{datetime2}%日期处理宏包
\RequirePackage[amsmath,thref,thmmarks]{ntheorem}% 定理类环境宏包，其中 amsmath 选项用来兼容 \AmSTeX\ 的宏包
\RequirePackage{listings}%格式化源程序（代码）
\RequirePackage[algoruled, linesnumbered, algochapter]{algorithm2e}%算法
\RequirePackage[square, super, comma, sort&compress]{natbib}%参考文献宏包

\hyphenation{SCUN-Thesis}
\def\scunthesis{\textsc{SCUNThesis}}
\def\version{1.0}

\makeatletter

\SetupKeyvalOptions{%kvoptions包设置
    family=scun,
    prefix=scun@,
    setkeys=\kvsetkeys
}
%学位论文类型
\newboolean{scun@socialbachelor}%社会科学类学士学位论文
\newboolean{scun@naturalbachelor}%自然科学类学士学位论文
\newboolean{scun@master}%硕士学位论文
\newboolean{scun@specializedmaster}%专业硕士学位论文
\newboolean{scun@equivalentmaster}%同等学历人员硕士学位论文
\newboolean{scun@doctor}%博士学位论文
\define@key{scun}{type}{
    \setboolean{scun@socialbachelor}{false}
    \setboolean{scun@naturalbachelor}{false}
    \setboolean{scun@master}{false}
    \setboolean{scun@specializedmaster}{false}
    \setboolean{scun@equivalentmaster}{false}
    \setboolean{scun@doctor}{false}
    \expandafter\setboolean{scun@#1}{true}}
\def\scun@deprecated@type@option{%
    \kvsetkeys{scun}{type=\CurrentOption} % for compatability.
    \ClassError{scunthesis}{Option '\CurrentOption' is deprecated, \MessageBreak
        please use 'type=\CurrentOption' instead}{}}
\DeclareVoidOption{socialbachelor}{\scun@deprecated@type@option}
\DeclareVoidOption{naturalbachelor}{\scun@deprecated@type@option}
\DeclareVoidOption{master}{\scun@deprecated@type@option}
\DeclareVoidOption{specializedmaster}{\scun@deprecated@type@option}
\DeclareVoidOption{equivalentmaster}{\scun@deprecated@type@option}
\DeclareVoidOption{doctor}{\scun@deprecated@type@option}
\DeclareBoolOption{minor}%辅修学士学位论文标志
\setkeys{scun}{minor=false}
\def\minor{\boolean{scun@minor}}
\DeclareBoolOption{secret}%涉密论文标志
\setkeys{scun}{secret=false}
\def\secret{\boolean{scun@secret}}

\DeclareDefaultOption{\PassOptionsToClass{\CurrentOption}{book}}
\ProcessKeyvalOptions*
\PassOptionsToPackage{no-math}{fontspec}

\ifthenelse{\boolean{scun@socialbachelor} \or \boolean{scun@naturalbachelor} \or
    \boolean{scun@master} \or \boolean{scun@specializedmaster} \or \boolean{scun@equivalentmaster} \or
    \boolean{scun@doctor}} %then
{}%else
{%
    \ClassError{scunthesis}{
        Please specify thesis type in option: \MessageBreak
        type=[socialbachelor | naturalbachelor | master | specializedmaster | equivalentmaster | doctor]
    }{}
}

\newcommand\scun@def@term[1]{%
    \DeclareStringOption{#1}
    \expandafter\newcommand\csname #1\endcsname[1][]{%
        \ifthenelse{\isempty{##1}}%then
        {\csname scun@#1\endcsname}%else
        {\setkeys{scun}{#1 = ##1}}%
    }%
}

\newcommand\scun@def@ceterm[1]{%
    \DeclareStringOption{c#1}
    \DeclareStringOption{e#1}
    \expandafter\newcommand\csname c#1\endcsname[1][]{%
        \ifthenelse{\isempty{##1}}%then
        {\csname scun@c#1\endcsname}%else
        {\setkeys{scun}{c#1 = ##1}}%
    }%
    \expandafter\newcommand\csname e#1\endcsname[1][]{%
        \ifthenelse{\isempty{##1}}%then
        {\csname scun@e#1\endcsname}%else
        {\setkeys{scun}{e#1 = ##1}}%
    }%
    \expandafter\newcommand\csname #1\endcsname[2]{
        \csname c#1\endcsname[##1]
        \csname e#1\endcsname[##2]
    }%
}

\scun@def@term{secretYears}
\secretYears[10]
\scun@def@term{secretLevel}
\secretLevel[内部]
\scun@def@term{SchoolCode}
\SchoolCode[10524]
\scun@def@term{ClassificationNumber}
\scun@def@term{stuID}
\scun@def@ceterm{Title}
\scun@def@ceterm{SubTitle}
\scun@def@ceterm{Author}
\scun@def@ceterm{University}
\cUniversity[中南民族大学]
\eUniversity[South-Central University for Nationalities]
\scun@def@ceterm{Department}
\scun@def@ceterm{Supervisor}
\scun@def@ceterm{SupervisorTitle}
\scun@def@ceterm{AssoSupervisor}
\scun@def@ceterm{AssoSupervisorTitle}
\scun@def@ceterm{CoSupervisor}
\scun@def@ceterm{CoSupervisorTitle}
\scun@def@ceterm{Major}
\scun@def@ceterm{Direction}
\scun@def@term{SubjectDate}
\scun@def@term{DefenceDate}
\scun@def@term{Chairman}
\scun@def@term{bsDate}
\scun@def@term{bsUniversity}
\scun@def@term{msDate}
\scun@def@term{msUniversity}
\scun@def@term{Category}
\scun@def@term{Discipline}
\scun@def@term{CopyRight}
\scun@def@ceterm{Abstract}
\scun@def@ceterm{Keywords}

\geometry{%纸张大小
    a4paper, % 210 * 297mm
    hcentering,
    ignoreall,
    nomarginpar}
\ifthenelse{\boolean{scun@socialbachelor} \or \boolean{scun@naturalbachelor}}{%
    \geometry{%学士学位论文页面设置
        left=3.17cm, right=3.17cm, top=2.54cm, headheight=0.5cm, headsep=0.5cm,
        %textheight=246.2mm,
        bottom=2.54cm, footskip=1cm}%
}{%
    \geometry{%研究生学位论文页面设置
        left=2.5cm,right=2.5cm, top=2.2cm, headheight=0.8cm, headsep=0.5cm,
        %textheight=237mm,
        bottom=2.2cm, footskip=1.1cm}%
}

\let\scunClearDP\cleardoublepage
\let\scunClearPage\clearpage

\ifthenelse{\boolean{scun@socialbachelor} \or \boolean{scun@naturalbachelor}}{%
	\fancypagestyle{plain}{%
		\fancyhf{}
		\fancyfoot[C]{\hei\xiaowu\thepage}
		\renewcommand{\headrulewidth}{0pt}
		\renewcommand{\footrulewidth}{0pt}}
		\let\cleardoublepage\relax
		\let\clearpage\relax
}{%
	\fancypagestyle{plain}{%
		\fancyhf{}
		\fancyhead[CO]{\wuhao\song\cUniversity%
			\ifthenelse{\boolean{scun@socialbachelor} \or \boolean{scun@naturalbachelor}}%
			{本科毕业论文（设计）}{\ifthenelse{\boolean{scun@doctor}}{博士}{硕士}学位论文}}
		\fancyhead[CE]{\wuhao\song\cTitle}
		\fancyfoot[C]{\hei\wuhao\thepage}
		\renewcommand{\headrulewidth}{0.5pt}
		\renewcommand{\footrulewidth}{0pt}}
}

\renewcommand\frontmatter{%
    \scunClearPage
    \pagestyle{empty}}

\renewcommand\mainmatter{%
	\scunClearPage
	\pagestyle{plain}
    \pagenumbering{arabic}
    \setlength\parindent{2em}
    \setcounter{secnumdepth}{3}
	\setstretch{1.0}
    \ifthenelse{\boolean{scun@socialbachelor} \or \boolean{scun@naturalbachelor}}%
	    {\song\wuhao}{\song\xiaosi}%
	\setlength{\parskip}{0pt}
}
\renewcommand\backmatter{\scunClearPage}

\def\takeTheRest#1\ofTheString\fi{\fi\@labeltext#1\wholeString}
\def\@labeltext#1#2\wholeString {%
    \if#2^%
    #1
    \else#1\hspace{\fill}\takeTheRest#2\ofTheString%
    \fi
}%
\newcommand{\insertspace}[1]{%
    \@labeltext#1^\wholeString%
}

\def\textboxed#1{\setlength{\fboxsep}{0pt}\raisebox{1pt}{\fbox{#1}}}
\newcommand{\BlankBox}{\textboxed{\color{white}$\surd$}}
\newcommand{\CheckedBox}{\textboxed{$\surd$}}

\newcommand{\textls}[2][1pt]{
    \let\oriCJKglue\CJKglue
    \renewcommand{\CJKglue}{\hskip #1 plus 0.08\baselineskip}%
    #2%
    \let\CJKglue\oriCJKglue%
}

\def\myThesisTitle{%
	\ifthenelse{\boolean{scun@socialbachelor} \OR \boolean{scun@naturalbachelor}} {毕业论文（设计）} {%
    \ifthenelse{\boolean{scun@doctor}}{博士}{%
        \ifthenelse{\boolean{scun@specializedmaster}}{专业}{%
            \ifthenelse{\boolean{scun@equivalentmaster}}{同等学历人员}{}}%
        硕士}%
学位论文}%
}

%%%定制日期显示格式
\DTMnewdatestyle{cnDateStyle}{%
		\renewcommand{\DTMdisplaydate}[4]{\number##1年\number##2月\number##3日}%
}
\DTMnewdatestyle{enDateStyle}{%
	\renewcommand{\DTMdisplaydate}[4]{\DTMmonthname{##2}, ##1}%
}
\newcommand{\printdate}[2][e]{%
	\ifthenelse{\equal{#1}{e}}{\DTMsetdatestyle{enDateStyle}}{\DTMsetdatestyle{cnDateStyle}}%
	\DTMsavedate{tmpDate}{#2}%
	\DTMusedate{tmpDate}%
}

\def\mdCover{%
    \newgeometry{left=3cm,right=3cm, top=3cm, bottom=3cm}
    \noindent
    \vskip 2 cm
    \hei\xiaosi
    \parbox{26em}{
        \vskip 1.4cm
        \setstretch{1.4}
        \makebox[4em][s]{\insertspace{学校代号}}\underline{\makebox[7em]{\SchoolCode}}%
        \hspace{\fill}%
        \makebox[4em][s]{\insertspace{学号}}\underline{\makebox[7em]{\stuID}}%

        \makebox[4em][s]{\insertspace{分类号}}\underline{\makebox[7em]{\ClassificationNumber}}%
        \hspace{\fill}%
        \makebox[4em][s]{\insertspace{密级}}\underline{\makebox[7em]{\ifthenelse{\secret}{\secretLevel}{~}}}%
    }
    \hspace{3em}
    \parbox{9em}{\includegraphics[height=2.88cm,width=2.8cm]{logo.pdf}}
    \begin{center}
        \vskip 1.7 cm
        \includegraphics[height=3cm,width=10cm]{name.pdf}
        \vskip 1.4 cm
        \hei\ifthenelse{\boolean{scun@equivalentmaster}}{\fontsize{32pt}{\baselineskip}\selectfont}{\chuhao}\textls{\myThesisTitle}
        \vskip 1.4 cm
        \begin{center}
            \setstretch{1.5}\parbox{26em}{\hei\yihao\centering\textls{\cTitle}}
        \end{center}
        \vskip 40 pt
        \begin{spacing}{1.2}
            \hei\xiaosi
            \makebox[7em][s]{学位申请人姓名}\underline{\makebox[7cm]{\song \cAuthor}} \\
            \makebox[7em][s]{培养单位}\underline{\makebox[7cm]{\song \cUniversity}} \\
            \makebox[7em][s]{导师姓名及职称}\underline{\makebox[7cm]{\song \cSupervisor~~\cSupervisorTitle}} \\
            \makebox[7em][s]{学科专业}\underline{\makebox[7cm]{\song \cMajor}} \\
            \makebox[7em][s]{研究方向}\underline{\makebox[7cm]{\song \cDirection}} \\
            \makebox[7em][s]{论文提交日期}\underline{\makebox[7cm]{\song\printdate[c]{\scun@SubjectDate}}}
        \end{spacing}
    \end{center}
    \restoregeometry
    \newpage
    \begin{flushleft}
        \setlength\parindent{1.5cm}
        \setstretch{1.2}\song\wuhao
        ~\\~\\~\\~\par
        \setstretch{1.2}\hei\xiaosi
        \makebox[4em][s]{学校代号}：\SchoolCode\par
        \makebox[4em][s]{\insertspace{学号}}：\stuID\par
        \makebox[4em][s]{\insertspace{密级}}：\par
        \song\wuhao
        ~\\
        \setstretch{1.2}\song\xiaoer
        \textbf{\textls{\cUniversity\myThesisTitle}}
        \setstretch{1.5}\song\wuhao
        ~\\~\\
        \setstretch{1.2}
        \parbox{22em}{\hei\erhao\textls{\cTitle}}
        \setstretch{1.5}\song\wuhao
        ~\\~\\~\par
        \setstretch{1.2}\hei\xiaosi
        \underline{\makebox[7em][s]{学位申请人姓名}： \makebox[20em]{\song \cAuthor}}\\
        \underline{\makebox[7em][s]{导师姓名及职称}：\makebox[20em]{\song \cSupervisor~~\cSupervisorTitle}}\\
        \underline{\makebox[7em][s]{培养单位}：\makebox[20em]{\song \cUniversity}}\\
        \underline{\makebox[7em][s]{专业名称}：\makebox[20em]{\song \cMajor}}\\
        \underline{\makebox[7em][s]{论文提交日期}：\makebox[20em]{\song\printdate[c]{\scun@SubjectDate}}}\\
        \underline{\makebox[7em][s]{论文答辩日期}：\makebox[20em]{\song\printdate[c]{\scun@DefenceDate}}}\\
        \underline{\makebox[7em][s]{答辩委员会主席}：\makebox[20em]{\song\Chairman}}
    \end{flushleft}
    \newpage

    %% 英文扉页
    \begin{center}
        \setstretch{1.2}\sanhao
        ~\\
        ~\\
        \eTitle
        {\setstretch{1.0}\wuhao ~\\}
        \setstretch{1.3}\sihao
        by \\
        \eAuthor \\
        B.E.(\bsUniversity)\bsDate \\
        \ifthenelse{\boolean{scun@doctor}}{M.S.( \msUniversity ) \msDate\\}{}
        A \ifthenelse{\boolean{scun@doctor}}{dissertation}{thesis} submitted in partial satisfaction of the \\
        Requirements for the degree of \\
        \ifthenelse{\boolean{scun@doctor}}{Doctor}{Master} of \Category \\
        in \\
        \Discipline \\
        in the \\
        Graduate School \\
        of \\
        \eUniversity \\
        ~\\
        Supervisor \\
        \eSupervisorTitle~~\eSupervisor \\
        \printdate{\scun@SubjectDate}
    \end{center}
    \newpage

    %% 学位论文原创性声明与版权使用授权书
    \setstretch{1.2}\song\banxiaosi\setlength\parindent{2em}
    \begin{center}
        \hei\xiaoer 中南民族大学\\学位论文原创性声明
    \end{center} \par
    本人郑重声明：所呈交的论文是本人在导师的指导下独立进行研究所取得的研究成果。除了文中特别加以标注引用的内容外，本论文不包含任何其他个人或集体已经发表或撰写的成果作品。对本文的研究做出重要贡献的个人和集体，均已在文中以明确方式标明。本人完全意识到本声明的法律后果由本人承担。\par
    ~\par
    作者签名：\hskip 7 em 日期：\makebox[10em][s]{~年月日}\par
    \begin{center}
        \hei\xiaoer 学位论文版权使用授权书
    \end{center}\par
    本学位论文作者完全了解学校有关保留、使用学位论文的规定，同意学校保留并向国家有关部门或机构送交论文的复印件和电子版，允许论文被查阅和借阅。本人授权中南民族大学可以将本学位论文的全部或部分内容编入有关数据库进行检索，可以采用影印、缩印或扫描等复制手段保存和汇编本学位论文。\par
    本学位论文属于\par
    \setlength\parindent{9em}
    1、保密\ifthenelse{\secret}{\CheckedBox}{\BlankBox}，在\underline{\makebox[3em]{\ifthenelse{\secret}{\secretYears 年}{}}}解密后适用本授权书。

    2、不保密\ifthenelse{\secret}{\BlankBox}{\CheckedBox}。\par
    （请在以上相应方框内打“$\surd$”）\par
    ~\par
    \setlength\parindent{2em}
    作者签名：\hskip 7 em 日期：\makebox[10em][s]{~年月日}\par
    导师签名：\hskip 7 em 日期：\makebox[10em][s]{~年月日}
    \clearpage
}

\def\bachelorCover{
    \newgeometry{left=3.18cm,right=3.18cm, top=2.54cm, bottom=2.54cm}
    \noindent
    \vskip 2cm
    \begin{center}
        \song
        \xiaochu\textbf{\textls[2pt]{\cUniversity}}
        \vskip 2.5cm
        \erhao\textbf{\textls[1.5pt]{毕业论文(设计)}}
        \vskip 6cm
        \setstretch{1.2}\kai\erhao
        \begin{tabular*}{18em}{l}
            \textbf{学院}\underline{:\makebox[14.5em]{\cDepartment}}\\
            \textbf{专业}\underline{:\makebox[9em]{\cMajor}}\textbf{年级}\underline{:\makebox[3em]{\bsDate}}\\
            ~\\
            \textbf{题目}{\setstretch{1.2}\erhao\underline{:\parbox{14.5em}{\cTitle}}}\\
            ~\\
            \textbf{学生姓名}\underline{:\makebox[4em]{\cAuthor}}\textbf{学号}\underline{:\makebox[6em]{\stuID}}\\
            ~\\
            \textbf{指导教师姓名}\underline{:\makebox[4em]{\cSupervisor}}\textbf{职称}\underline{:\makebox[4em]{\cSupervisorTitle}}
        \end{tabular*}
        \vskip 3cm
%       	\printdate[c]{\scun@SubjectDate}
        \ifthenelse{\equal{\scun@SubjectDate}{}}{}{\printdate[c]{\scun@SubjectDate}}
        \newpage
    \end{center}
    \leftskip 0.5em \rightskip 0.5em
    \song
    ~\vskip 3cm
    \centerline{\textbf{\xiaoer 中南民族大学本科毕业论文（设计）原创性声明}}
    \vskip 1cm
	\par
	\setstretch{1.2}
	\setlength\parindent{2em}
	\sanhao
	本人郑重声明：所呈交的论文是本人在导师的指导下独立进行研究所取得的研究成果。除了文中特别加以标注引用的内容外，本论文不包含任何其他个人或集体已经发表或撰写的成果作品。本人完全意识到本声明的法律后果由本人承担。
	\vskip 3cm
	\rightline{作者签名：\hskip 4em \makebox[10em][s]{~年月日}\hspace{0.5em}}
    \leftskip 0em \rightskip 0em
    \restoregeometry
    \newpage
}

\newcommand{\makecover}{
    \ifthenelse{\boolean{scun@socialbachelor} \OR \boolean{scun@naturalbachelor}}%
	    {\bachelorCover}{\mdCover}}

%%目录
\ifthenelse{\boolean{scun@socialbachelor} \OR \boolean{scun@naturalbachelor}}{%
	\def\tocTitlestyle{\hei\sihao}
	\def\tocHangStyle{\song\wuhao}
}{%
	\def\tocTitlestyle{\hei\sihao}
	\def\tocHangStyle{\song\xiaosi}
}
\renewcommand{\contentsname}{\tocTitlestyle 目\hskip 1em 录\\ }
\let\ori@tableofcontents\tableofcontents
\renewcommand{\tableofcontents}{%
	\setstretch{1}
	\def \label@seperator@toc{%
		\ifthenelse{\boolean{scun@socialbachelor}}{\hspace{0em}}{\hspace{1em}}%
	}%
	\setcounter{tocdepth}{2}
    \titlecontents{chapter}[0pt]{\tocHangStyle}%
	    {	\ifthenelse{\boolean{scun@socialbachelor}}{\cnumber{\thecontentslabel}、}%
		    { \ifthenelse{\boolean{scun@naturalbachelor}}{\thecontentslabel}{第~\thecontentslabel~章}}%
		    \label@seperator@toc%
		}%
        {}%
        {\titlerule*[0.5em]{.}\contentspage}
    \titlecontents{section}[2em]{\tocHangStyle}%
        {\thecontentslabel\label@seperator@toc}%
        {}%
        {\titlerule*[0.5em]{.}\contentspage}
    \titlecontents{subsection}[4em]{\tocHangStyle}%
        {\thecontentslabel\label@seperator@toc}%
        {}%
        {\titlerule*[0.5em]{.}\contentspage}
    \setcounter{page}{1}
    \pagenumbering{roman}
	\contentsmargin{1em}
    \ori@tableofcontents
    \newpage
}
%%摘要
%%关键字
\newcommand\keywords{%
	~\par
	\def\parselist##1{%
		\def\lastitem{##1}%
		\futurelet\next\getoneitem
	}
	\def\getoneitem{%
		\ifx\next\bgroup
		\let\go\getnextitem
		\else
		\let\go\getlastitem
		\fi
		\go
	}
	\def\getnextitem##1{%
		\lastitem;
		\def\lastitem{##1}%
		\futurelet\next\getoneitem
	}
	\def\getlastitem{\lastitem}%
	%
	\noindent\newline\rmfamily
	\textbf{\sihao Keywords:}
	\let\go\parselist\go
}
\newcommand\cnKeywords{%
	~\par
	\def\parselist##1{%
		\def\lastitem{##1}%
		\futurelet\next\getoneitem
	}
	\def\getoneitem{%
		\ifx\next\bgroup
		\let\go\getnextitem
		\else
		\let\go\getlastitem
		\fi
		\go
	}
	\def\getnextitem##1{%
		\lastitem；
		\def\lastitem{##1}%
		\futurelet\next\getoneitem
	}
	\def\getlastitem{\lastitem}%
	%
	\noindent\newline
	{\hei\sihao 关键字：}
	\let\go\parselist\go
}

\newenvironment{cnAbstract}
{%
	\pagestyle{plain}\pagenumbering{Roman}
	\addcontentsline{toc}{chapter}{摘要}%
	\ifthenelse{\boolean{scun@socialbachelor} \OR \boolean{scun@naturalbachelor}}%
	{%
		\song\wuhao%
		\begin{center}
			\xiaoer\hei\cTitle
		\end{center}
		\vskip 1em
		\noindent\sihao\hei 摘要：\wuhao\song
	}{
		\song\xiaosi%
		\chapter*{摘~要}
	}%
}%
{%
	\ifthenelse{\boolean{scun@socialbachelor} \OR \boolean{scun@naturalbachelor}}%
	{}%
	{\newpage}%
}

%%abstract
\newenvironment{abstract}
{%
	\pagestyle{plain}
	\ifthenelse{\boolean{scun@socialbachelor} \OR \boolean{scun@naturalbachelor}}%
	{%
		\addcontentsline{toc}{chapter}{Abstract}%
		\begin{center}
			~\\ \sanhao\textbf{\eTitle}
		\end{center}
		\vskip 1em
		\noindent\sihao\textbf{Abstract: }\wuhao\setstretch{0.85}
	}%
	{%
		\addcontentsline{toc}{chapter}{ABSTRACT}%
		\song\xiaosi\setstretch{0.85}
		\chapter*{ABSTRACT}
	}
}
{\newpage}


%%正文元素
%章节标题
\ifthenelse{\boolean{scun@socialbachelor} \OR \boolean{scun@naturalbachelor}}%
{%
	\ifthenelse{\boolean{scun@socialbachelor}}{%
			\renewcommand{\chaptername}{\cnumber{\thechapter}、}%
			\renewcommand{\thesection}{（\cnumber{\arabic{section}}）}%
			\renewcommand{\thesubsection}{\cdigit{\arabic{subsection}}．}%
			\renewcommand{\thesubsubsection}{（\cdigit{\arabic{subsubsection}}）}%
			\def \label@seperator{0em}
			\titleformat{\subsection}[hang]{\hei\wuhao}{\hspace{2em}\thesubsection}{\label@seperator}{}%
			\titleformat{\subsubsection}[hang]{\hei\wuhao}{\hspace{2em}\thesubsubsection}{\label@seperator}{}%
		}{%
			\renewcommand{\chaptername}{\cdigit{\thechapter}}%
			\def \label@seperator{1em}%
			\titleformat{\subsection}[hang]{\hei\wuhao}{\thesubsection}{\label@seperator}{}%
			\titleformat{\subsubsection}[hang]{\hei\wuhao}{\thesubsubsection}{\label@seperator}{}%
		}%

    % 设置正文中图表的格式
    \renewcommand\tablename{表}
    \renewcommand\figurename{图}
    \numberwithin{figure}{chapter}
    \numberwithin{table}{chapter}
    \renewcommand\thefigure{\arabic{chapter}-\arabic{figure}}
    \renewcommand\thetable{\arabic{chapter}-\arabic{table}}
%     \captionsetup{labelformat=default,labelsep=space} %去除冒号

	\titleformat{\chapter}[hang]{\hei\sihao}{\chaptername}{\label@seperator}{}
	\titleformat{\section}[hang]{\hei\xiaosi}{\thesection}{\label@seperator}{}
	\titlespacing{\chapter}{0pt}{1em}{0.5em}
	\titlespacing*{\section}{0em}{0.5em}{*0}
	\titlespacing*{\subsection}{0em}{0em}{*0}
	\titlespacing*{\subsubsection}{0em}{0em}{*0}
}%
{%
	\renewcommand{\chaptername}{第~\cdigit{\thechapter}~章}
	\titleformat{\chapter}[hang]{\centering\hei\xiaoer}{\chaptername}{1em}{}
	\titlespacing{\chapter}{0pt}{4pt}{*4}
	\titleformat{\section}[hang]{\hei\xiaosan}{\thesection}{1em}{}
	\titleformat{\subsection}[hang]{\hei\xiaosi}{\thesubsection}{1em}{}
	\titleformat{\subsubsection}[hang]{\hei\xiaosi}{\thesubsubsection}{1em}{}
}

%%多级列表使用宏包enumitem，最多3级
\newenvironment{parList}
{
    \ifx\c@myparlistdepth\undefined{\newcounter{myparlistdepth}} \fi
    \stepcounter{myparlistdepth}
    \ifnum \value{myparlistdepth}=1
        \SetEnumitemValue{label}{labelformat}{\arabic*)}
    \else
        \ifnum \value{myparlistdepth}=2
            \SetEnumitemValue{label}{labelformat}{\roman*)}
        \else
            \SetEnumitemValue{label}{labelformat}{\alph*)}
        \fi
    \fi
    \setlist{label=labelformat, labelsep=0.5em, listparindent=2em, itemindent=2em, leftmargin=\parindent,
                parsep=0pt, itemsep=0pt, topsep=0pt
    }
    \ifthenelse{\boolean{scun@socialbachelor} \or \boolean{scun@naturalbachelor}}{\wuhao}{\xiaosi}%
    \begin{enumerate}
}
{
    \addtocounter{myparlistdepth}{-1}
    \end{enumerate}
    \par
}

%%行内列表
\def \ilnumFnt{%
\ifthenelse{\boolean{scun@socialbachelor} \OR \boolean{scun@naturalbachelor}}%
	{\liuhao}{\xiaowu}%
}
\newcommand\inlinelist{%
    \def\parselist##1{%
        \def\lastitem{\addtocounter{ilitemscount}{1}\textcircled{\ilnumFnt\arabic{ilitemscount}} ##1}%
        \futurelet\next\getoneitem
    }%
    \def\getoneitem{%
        \ifx\next\bgroup
            \let\go\getnextitem
        \else
            \let\go\getlastitem
        \fi
        \go
    }%
    \def\getnextitem##1{%
        \lastitem
        \def\lastitem{\addtocounter{ilitemscount}{1}\textcircled{\ilnumFnt\arabic{ilitemscount}} ##1}%
        \futurelet\next\getoneitem
    }%
    \def\getlastitem{\lastitem}%
    %
    \ifx\c@ilitemscount\undefined{\newcounter{ilitemscount}}\else{\setcounter{ilitemscount}{0}}\fi
    \let\go\parselist\go
}


%使用定理环境的交叉引用，要加上thref选项；使用证明结束符，要加上thmmarks选项（？）
\theoremstyle{plain}%定理环境风格，plain是LaTeX的原始风格
\theoremheaderfont{\hei}%定理头部字体
\theorembodyfont{}%定理内容字体
\theoremseparator{\hspace{1em}}%定理头部与内容间相隔的距离
\theoremnumbering{arabic}%定理的计数采用阿拉伯数字
\theoremsymbol{}%定理结束符
\newtheorem{definition}{\hspace{2em}定义}[chapter]%定义定义环境名为definition，显示如“定理1.1.1”
\newtheorem{axiom}{\hspace{2em}公理}[chapter]%定义公理环境名为axiom，显示如“公理1”
\newtheorem{theorem}{\hspace{1em}定理}[chapter]
\newtheorem{propsition}{\hspace{1em}命题}[chapter]
\newtheorem{corollary}{\hspace{1em}推论}[chapter]
\newtheorem{lemma}{\hspace{1em}引理}[chapter]
\newtheorem{example}{\hspace{1em}例}[chapter]
\newtheorem{exercise}{\hspace{1em}习题}[chapter]

%设置证明环境，仍然用的ntheorem宏包的定理环境
\theoremstyle{nonumberplain}%nonumberplain是不编号的定理环境
\theoremsymbol{\ensuremath{\Box}}%设置定理结束符
\newtheorem{proof}{\hspace{2em}证}
\newtheorem{solution}{\hspace{2em}解}
\newtheorem{notation}{\hspace{2em}注}

\setlength{\theorempreskipamount}{0em}%调整定理环境与上文的距离
\setlength{\theorempostskipamount}{0em}%调整定理环境与下文的距离

%由于前面把“定理”字样改成了“　　定理”，所以直接引用\thref会在“定理”前加两个空格
%所以这里重定义\thref命令
\let\oldthref\thref
\renewcommand{\thref}[1]{\hspace{-2em}\oldthref{#1}}

\numberwithin{equation}{section}%使每节公式重新编号

%%图形
%%单个图形、多个图形
%%表格
%%公式
\renewcommand{\theequation}{\thechapter--\arabic{equation}}
\renewcommand{\eqref}[1]{公式\ref{#1}}
%%  行内公式
%%  行间公式

%%算法
%\renewcommand{\algorithmcfname}{\textbf{\wuhao\hei 算法}}
\SetAlgorithmName{算法}{算法}{}
\SetAlgoProcName{过程}{过程}
\SetAlgoFuncName{函数}{函数}
\SetAlCapSty{textbf}
\SetAlCapNameSty{textbf}
\ifthenelse{\boolean{scun@socialbachelor} \OR \boolean{scun@naturalbachelor}}{%
	\SetAlCapFnt{\hei\wuhao}
	\SetAlCapNameFnt{\hei\wuhao}
}{%
	\SetAlCapFnt{\hei\xiaosi}
	\SetAlCapNameFnt{\hei\xiaosi}
}
\newcommand{\scunAlgorithm}[4]{%
	\vskip 0.5em
	\IncMargin{1em}
	\begin{algorithm}[!htb]
		\begin{spacing}{0.85}
			\ifthenelse{\boolean{scun@socialbachelor} \OR \boolean{scun@naturalbachelor}}{\xiaowu}{\wuhao}%
			\caption{#1}
			\label{#1}
			\SetAlgoNoLine
			\SetKwInOut{Input}{输入}\SetKwInOut{Output}{输出}
			\Input{#2}
			\Output{#3}
			{ #4}
		\end{spacing}
	\end{algorithm}
	\ifthenelse{\boolean{scun@socialbachelor} \OR \boolean{scun@naturalbachelor}}{\wuhao}{\xiaosi}%
	\DecMargin{1em}
	\vskip 0.5em
}
%%程序代码
%%参考文献
\newcommand{\references}[1]{%
	\ifthenelse{\boolean{scun@socialbachelor} \OR \boolean{scun@naturalbachelor}}{%
		~\par
		\renewcommand{\bibfont}{\song\xiaowu}
		\renewcommand\bibname{\centerline{\hei\sihao 参考文献}\\ }%
	}{%
		\renewcommand{\bibfont}{\song\wuhao}
		\renewcommand\bibname{\centerline{\xiaoer\hei 参考文献}}%
	}
	\addcontentsline{toc}{chapter}{参考文献}%
	\ifthenelse{\boolean{scun@naturalbachelor}}{%
		\bibliographystyle{scun.bachelor.nat}%
	}{%
		\ifthenelse{\boolean{scun@socialbachelor}}{%
			\bibliographystyle{scun.bachelor.soc}
		}{%
			\bibliographystyle{scun.master.phd}
		}%
	}%
	\renewcommand\bibsection{\chapter*{\bibname} }
	\setlength{\bibsep}{0.4em}
	\begin{spacing}{0.85}
	\bibliography{#1}%
	\end{spacing}
}

%% 致谢
\newenvironment{acknowledgement}
{%
	\addcontentsline{toc}{chapter}{致谢}%
	\ifthenelse{\boolean{scun@socialbachelor} \OR \boolean{scun@naturalbachelor}}{%
		~\par
		\chapter*{\centerline{\hei\sihao	致\hspace{1em}谢}}%
	}{%
		\chapter*{致谢}%
}}%
{%
	\ifthenelse{\boolean{scun@socialbachelor} \OR \boolean{scun@naturalbachelor}}%
	{}%
	{\newpage}%
}%

%%附录


\makeatother

\endinput
%%
%% End of file `scunthesis.cls'.
